package cn.yto.rocketmq.rocketmqselect.condition;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.util.StringUtils;

public class RocketMqTestConditional implements Condition {
    @Override
    public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
        Environment environment = conditionContext.getEnvironment();
        if (null != environment) {
            return StringUtils.hasLength(environment.getProperty("rocketmq.config.namesrvAddr"));
        }
        return false;
    }
}
